home *** CD-ROM | disk | FTP | other *** search
- /* DELAY - Delay for a period
-
- Version 1.04, created on 08/14/85 at 12:12:43
-
- (C) COPYRIGHT 1985 by System Enhancement Associates; ALL RIGHTS RESERVED
-
- By: Thom Henderson
-
- Description:
- This program delays for a defined period of time, and then
- terminates. It is intended for use in batch files.
-
- Instructions:
- Invoke this program with a statement of the form:
-
- delay <n>
-
- Where <n> is the decimal number of seconds to delay. For example,
- to delay for ten seconds, type:
-
- delay 10
-
- Language:
- Computer Innovations Optimizing C86
- */
- #include <stdio.h>
-
- int count = 0; /* countdown timer */
-
- timer() /* timer tick routine */
- {
- count--; /* decrement the counter */
- }
-
- main(num,arg) /* system entry point */
- int num; /* number of arguments */
- char *arg[]; /* pointers to arguments */
- {
- int elev = 0; /* error level */
-
- if(num<2)
- abort("Usage: delay <n>");
-
- count = atoi(arg[1]) * 18; /* get delay counter */
- intrinit(timer,0,0x1c); /* take over timer interrupt */
-
- while(count>=0) /* wait for time to elapse */
- { if(!(count%18)) /* update display */
- printf("Time: %d \r",count/18);
- if(key_scan()!=EOF) /* abort if requested */
- { if((key_getc()&0xff)==27)
- { elev = 1;
- break;
- }
- }
- }
-
- intrrest(0x1c); /* give back timer interrupt */
- return elev;
- }
-